<template>
  <!-- 详情 -->
  <el-dialog
    :visible.sync="dialogVisible"
    title="互市企业信息备案详情"
    width="1200px"
    append-to-body
    :close-on-click-modal="false"
    :before-close="closedialog"
    class="self-dialog"
  >
    <el-tabs v-model="activeName" v-if="dialogVisible">
      <el-tab-pane label="基本信息" name="first">
        <el-descriptions :column="3" border>
          <el-descriptions-item>
            <template slot="label"> 主管海关 </template>
            <dict-value
              :list="customsList"
              :dictCode="form.mainPort"
            ></dict-value>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 企业代码 </template>
            {{ form.coCode }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 企业注册地 </template>
            <dict-tag
              :options="dict.type.sw_vehicle_reg_place"
              :value="form.coRegAddr"
            ></dict-tag>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 批准机关 </template>
            {{ form.apprDep }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 批准/许可批文号 </template>
            {{ form.apprNo }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 批准/许可批文有效期 </template>
            {{ form.apprValidTime }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 企业中文名称 </template>
            {{ form.coNameCn }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 企业外文名称 </template>
            {{ form.coNameEn }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 企业经营类型 </template>
            <dict-tag
              :options="dict.type.co_deal_type"
              :value="form.coDealType"
            ></dict-tag>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 企业经营资格 </template>
            {{ form.coDealQua }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 企业地址 </template>
            {{ form.coAddr }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 企业负责人 </template>
            {{ form.coRep }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 负责人联系电话 </template>
            {{ form.coRepPhone }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 境内联系地址 </template>
            {{ form.insideAddr }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 境内联系电话 </template>
            {{ form.insidePhone }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 运输工具服务企业名称 </template>
            {{ form.coServiceName }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 运输工具服务企业地址 </template>
            {{ form.coServiceAddr }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 运输工具服务企业联系电话 </template>
            {{ form.coServicePhone }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 批准货运车辆指标数 </template>
            {{ form.apprGoodsVeCount }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 批准客运车辆指标数 </template>
            {{ form.apprPassengersVeCount }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 担保方式 </template>
            <dict-tag
              :options="dict.type.sw_assure_type"
              :value="form.assureType"
            ></dict-tag>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 担保函编号 </template>
            {{ form.assureLetterNo }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 担保函金额 </template>
            {{ form.assureMoney }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 担保期限 </template>
            {{ form.assureTerm }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 担保企业组织机构代码 </template>
            {{ form.assureCoOrgCode }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 担保企业名称 </template>
            {{ form.assureCoName }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 担保企业法人代表 </template>
            {{ form.assureCoRep }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 担保企业电话 </template>
            {{ form.assureCoPhone }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 担保企业地址 </template>
            {{ form.assureCoAddr }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 担保企业联系人 </template>
            {{ form.assureCoContact }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 担保企业联系人电话 </template>
            {{ form.assureCoConPhone }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 企业备案类别 </template>
            <dict-tag
              :options="dict.type.co_rec_type"
              :value="form.coRecType"
            ></dict-tag>
          </el-descriptions-item>
          <!-- <el-descriptions-item>
            <template slot="label"> 数据操作类型 </template>
            {{ form.operationType }}
          </el-descriptions-item> -->
          <el-descriptions-item>
            <template slot="label"> 批文扫描图 </template>
            <div v-if="form.approNoPic">
              <a :href="baseUrl+form.approNoPic" style="text-decoration: underline;" target="_blank">
                <el-button icon="el-icon-view" size="mini" type="primary">查看照片</el-button>
              </a>
            </div>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 场所编码 </template>
            {{ form.fieldCode }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 回执代码 </template>
            {{ form.responseCode }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 回执描述 </template>
            {{ form.responseText }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 申报状态 </template>
            <dict-tag
              :options="dict.type.sw_vehicle_decl_status"
              :value="form.proposeStatus"
            ></dict-tag>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 最新更新申请业务类型 </template>
            {{ form.currApplyBussine }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 备注 </template>
            {{ form.memo }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 申请人 </template>
            {{ form.proposer }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 申请时间 </template>
            {{ form.proposeTime }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 创建人 </template>
            {{ form.createBy }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label"> 创建时间 </template>
            {{ form.createTime }}
          </el-descriptions-item>
        </el-descriptions>
      </el-tab-pane>
       <el-tab-pane label="批准行驶口岸列表" name="second">
        <allow-ie-port-list ref="allowPortList" dialogType="detail" :allowPortListData="form.allowApprPorts" :customsList="customsList"></allow-ie-port-list>
      </el-tab-pane>
      <el-tab-pane label="企业境外商号信息" name="third">
        <abroad-co-info ref="abroadCoInfo" dialogType="detail" :abroadCoInfosData="form.abroadCoInfos"></abroad-co-info>
      </el-tab-pane>
      <el-tab-pane label="企业内承单位信息" name="fourth">
        <assume-co-info ref="assumeCoInfo" dialogType="detail" :assumeCoInfosData="form.assumeCoInfos"></assume-co-info>
      </el-tab-pane>
      <el-tab-pane label="企业所属分支机构信息" name="fifth">
        <belong-part-org ref="belongPartOrg" dialogType="detail" :partOrgsData="form.partOrgs"></belong-part-org>
      </el-tab-pane>
    </el-tabs>
    <div slot="footer" class="dialog-footer" style="text-align: center">
      <el-button @click="closedialog">关闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { getCorporationInfo } from "@/api/swdecl/corporationInfo";
import abroadCoInfo from './sublist/abroadCoInfo.vue';
import assumeCoInfo from './sublist/assumeCoInfo.vue';
import BelongPartOrg from './sublist/belongPartOrg.vue';
import AllowIePortList from '../../components/allowIePortList.vue';

export default {
  name: "CorporationInfo-detail",
  components: {abroadCoInfo, assumeCoInfo, BelongPartOrg, AllowIePortList},
  props: {
    detailId: {},
    dict: {},
    customsList: {},
  },
  data() {
    return {
      //显示详情
      dialogVisible: false,
      activeName: "first",
      baseUrl: process.env.VUE_APP_BASE_FILE_URL,
      form: {
        id: null,
        eportId: null,
        coCode: null,
        mainPort: null,
        coRegAddr: null,
        apprDep: null,
        apprNo: null,
        apprValidTime: null,
        coNameCn: null,
        coNameEn: null,
        coDealType: null,
        coDealQua: null,
        coAddr: null,
        coRep: null,
        coRepPhone: null,
        insideAddr: null,
        insidePhone: null,
        coServiceName: null,
        coServiceAddr: null,
        coServicePhone: null,
        apprGoodsVeCount: null,
        apprPassengersVeCount: null,
        assureType: null,
        assureLetterNo: null,
        assureMoney: null,
        assureTerm: null,
        assureCoOrgCode: null,
        assureCoName: null,
        assureCoRep: null,
        assureCoPhone: null,
        assureCoAddr: null,
        assureCoContact: null,
        assureCoConPhone: null,
        memo: null,
        currApplyBussine: null,
        proposer: null,
        proposeTime: null,
        coRecType: null,
        operationType: null,
        approNoPic: null,
        fieldCode: null,
        proposeStatus: "0",
        responseCode: null,
        responseText: null,
        responseType: null,
        createBy: null,
        createTime: null,
      },
    };
  },
  watch: {
    detailId: {
      immediate: true,
      handler(val) {
        if (val) {
          this.loadDetail();
        }
      },
    },
  },
  methods: {
    open() {
      this.dialogVisible = true;
      this.activeName = "first";
    },
    closedialog() {
      this.dialogVisible = false;
    },
    // 获取详情
    loadDetail() {
      getCorporationInfo(this.detailId).then((res) => {
        if (res.code == 200) {
          this.form = res.data;
        }
      });
    },
  },
};
</script>

<style>
</style>
